﻿<UserControl x:Class="SilveR.Views.StatsViews.PowerAnalysis"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             
    mc:Ignorable="d"
    d:DesignHeight="430" d:DesignWidth="685">
    <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
        <Grid>
            <Border Margin="3,3,3,3" Style="{StaticResource MainAnalysisBorderStyle}">
                <Grid>
                    <TextBlock Margin="3,3,0,0" Text="Input" Style="{StaticResource TextBlockStyle}" />

                    <ComboBox Name="cboData" Margin="15,160,0,0" ItemsSource="{Binding AvailableDataHandlers}" SelectedItem="{Binding SelectedDataHandler, Mode=TwoWay}" IsEnabled="{Binding UseDataSetValues}" DisplayMemberPath="DisplayFileName" SelectionChanged="cboData_SelectionChanged" Style="{StaticResource ComboBoxStyle}"/>

                    <TextBlock Margin="15,191,0,0" Text="Available variables" Style="{StaticResource TextBlockStyle}"/>
                    <toolkit:ListBoxDragDropTarget AllowDrop="True" Height="130" Margin="15,213,0,0" ItemDragCompleted="Target_ItemDragCompleted" Style="{StaticResource ListBoxDragDropTargetStyle}" >
                        <ListBox Name="lstAvailableVariables" DisplayMemberPath="ColumnName" ItemsSource="{Binding AvailableVariables, Mode=TwoWay}" IsEnabled="{Binding UseDataSetValues}" Style="{StaticResource ListBoxStyle}" />
                    </toolkit:ListBoxDragDropTarget>

                    <RadioButton Content="Use these values" Margin="12,28,0,0" GroupName="ValueSource" IsChecked="{Binding UseSuppliedValues, Mode=TwoWay}" Style="{StaticResource RadioButtonStyle}"/>
                    <TextBlock Margin="12,50,0,0" Text="Control or reference group mean"  Style="{StaticResource TextBlockStyle}"/>
                    <TextBox Margin="212,47,0,0" Text="{Binding GroupMean, Mode=TwoWay}" IsEnabled="{Binding UseSuppliedValues}" Style="{StaticResource TextBoxStyle}"/>
                    <RadioButton Content="Standard deviation" Margin="60,79,0,0" Name="rdoStDev" IsChecked="{Binding UseStandardDeviation, Mode=TwoWay}" IsEnabled="{Binding UseSuppliedValues}" Style="{StaticResource RadioButtonStyle}"/>
                    <TextBox Margin="212,76,0,0" Text="{Binding StandardDeviation, Mode=TwoWay}" IsEnabled="{Binding UseSuppliedValues}"  Style="{StaticResource TextBoxStyle}"/>
                    <TextBox Margin="212,105,0,0" Text="{Binding Variance, Mode=TwoWay}" IsEnabled="{Binding UseSuppliedValues}"  Style="{StaticResource TextBoxStyle}"/>
                    <RadioButton Content="Variance (MS residual)" Margin="60,108,0,0" Name="rdoVariance" IsChecked="{Binding UseVariance, Mode=TwoWay}" IsEnabled="{Binding UseSuppliedValues}" Style="{StaticResource RadioButtonStyle}"/>
                    <RadioButton Content="Use variables from the dataset" Margin="12,139,0,0" Name="rdoUseDataSetValues" GroupName="ValueSource" IsChecked="{Binding UseDataSetValues, Mode=TwoWay}" Style="{StaticResource RadioButtonStyle}"/>

                    <TextBlock Margin="169,191,0,0" Text="Response"  Style="{StaticResource TextBlockStyle}"/>
                    <toolkit:ListBoxDragDropTarget AllowDrop="True" Margin="169,212,0,0" DragOver="oneItem_DragOverOrDrop" Drop="oneItem_DragOverOrDrop" ItemDragCompleted="Target_ItemDragCompleted" Style="{StaticResource ListBoxDragDropTargetStyle}" >
                        <ListBox DisplayMemberPath="ColumnName" ItemsSource="{Binding ResponseList, Mode=TwoWay}" Style="{StaticResource ListBoxStyle}" />
                    </toolkit:ListBoxDragDropTarget>

                    <TextBlock Margin="169,242,0,0" Text="Treatment factor" Style="{StaticResource TextBlockStyle}" />
                    <toolkit:ListBoxDragDropTarget AllowDrop="True" Margin="169,260,0,0" DragOver="oneItem_DragOverOrDrop" Drop="oneItem_DragOverOrDrop" ItemDragCompleted="Target_ItemDragCompleted" IsEnabled="{Binding UseDataSetValues}" Style="{StaticResource ListBoxDragDropTargetStyle}">
                        <ListBox DisplayMemberPath="ColumnName" ItemsSource="{Binding TreatmentList, Mode=TwoWay}" Style="{StaticResource ListBoxStyle}" />
                    </toolkit:ListBoxDragDropTarget>

                    <ComboBox Name="cboControl" Margin="169,314,0,0" ItemsSource="{Binding ControlGroupList, Mode=TwoWay}" SelectedItem="{Binding ControlGroup, Mode=TwoWay}" IsEnabled="{Binding UseDataSetValues}" Style="{StaticResource ComboBoxStyle}"/>
                    <TextBlock Margin="169,295,0,0" Text="Control group" Style="{StaticResource TextBlockStyle}" />
                    <TextBlock Margin="67,353,0,0" Text="Significance level"  Style="{StaticResource TextBlockStyle}" />
                    <ComboBox  Margin="169,349,0,0" Name="cboSignificance" ItemsSource="{Binding SignificanceList}" SelectedItem="{Binding Significance, Mode=OneWay}" IsEnabled="{Binding UseDataSetValues}" Style="{StaticResource ComboBoxStyle}"/>
                </Grid>
            </Border>
            <Border HorizontalAlignment="Left" Margin="350,3,3,3" Style="{StaticResource MainAnalysisBorderStyle}">
                <Grid>
                    <TextBlock Margin="3,3,3,3" Text="Plot settings"  Style="{StaticResource TextBlockStyle}" />
                    <TextBlock Margin="3,350,0,0" Text="Graph title"  Style="{StaticResource TextBlockStyle}" />
                    <TextBox Height="23" Margin="67,348,0,0" Width="183" Text="{Binding GraphTitle}" Style="{StaticResource TextBoxStyle}"/>
                    <Border Margin="3,123,3,3" Style="{StaticResource MinorAnalysisBorderStyle}">
                        <Grid>
                            <TextBlock Margin="3,3,3,3" Text="Plotting range"  Style="{StaticResource TextBlockStyle}" />
                            <RadioButton Content="Sample size 6 to 15" Height="16" Margin="3,26,0,0" Width="142" IsChecked="{Binding UseSampleSize6To15, Mode=TwoWay}" GroupName="PlottingRange" Style="{StaticResource RadioButtonStyle}" />
                            <RadioButton Content="Sample size" Height="16" Margin="3,53,0,0" Width="120" GroupName="PlottingRange" IsChecked="{Binding UseCustomSampleSize, Mode=TwoWay}" Style="{StaticResource RadioButtonStyle}"/>
                            <RadioButton Content="Power (Y axis)" Height="16" Margin="3,108,0,0" Width="120" GroupName="PlottingRange" IsChecked="{Binding UsePower, Mode=TwoWay}" Style="{StaticResource RadioButtonStyle}"/>
                            <TextBlock Margin="27,80,0,0" Text="From"  Style="{StaticResource TextBlockStyle}"/>
                            <TextBox Height="23" Margin="73,76,0,0" Width="52" IsEnabled="{Binding UseCustomSampleSize}" Text="{Binding SampleSizeFrom, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}"/>
                            <TextBlock Margin="143,80,0,0" Text="To" Style="{StaticResource TextBlockStyle}"/>
                            <TextBox Height="23" Margin="175,76,0,0" Width="48" IsEnabled="{Binding UseCustomSampleSize}" Text="{Binding SampleSizeTo, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}"/>
                            <RadioButton Content="Target (70%-90%)" Margin="28,137,0,0" Width="132" GroupName="YAxisRange" IsEnabled="{Binding UsePower}" IsChecked="{Binding UseTargetPower, Mode=TwoWay}" Style="{StaticResource RadioButtonStyle}"/>
                            <RadioButton Content="Custom" Margin="28,159,0,0" Width="132" GroupName="YAxisRange" IsEnabled="{Binding UsePower}" IsChecked="{Binding UseCustomPower, Mode=TwoWay}" Style="{StaticResource RadioButtonStyle}"/>
                            <TextBlock Margin="50,186,0,0" Text="% From" Style="{StaticResource TextBlockStyle}"/>
                            <TextBlock Margin="160,186,0,0" Text="% To" Style="{StaticResource TextBlockStyle}"/>
                            <TextBox Margin="105,182,0,0" Width="49" Text="{Binding PowerFrom, Mode=TwoWay}" IsEnabled="{Binding UsePower}" Style="{StaticResource TextBoxStyle}"/>
                            <TextBox Margin="197,182,0,0" Width="49" Text="{Binding PowerTo, Mode=TwoWay}" IsEnabled="{Binding UsePower}" Style="{StaticResource TextBoxStyle}"/>
                        </Grid>
                    </Border>
                    <Border Margin="3,30,3,3" Style="{StaticResource MinorAnalysisBorderStyle}">
                        <Grid>
                            <TextBlock Margin="3,3,3,3" Text="Expected changes"  Style="{StaticResource TextBlockStyle}"/>
                            <RadioButton Content="Percent" Margin="3,32,0,0" Width="78" GroupName="ChangesType" IsChecked="{Binding UsePercentChange, Mode=TwoWay}"  Style="{StaticResource RadioButtonStyle}"/>
                            <RadioButton Content="Absolute" Margin="3,60,0,0" GroupName="ChangesType" IsChecked="{Binding UseAbsoluteChange, Mode=TwoWay}"  Style="{StaticResource RadioButtonStyle}"/>
                            <TextBox Margin="94,30,0,0" Text="{Binding PercentChange, Mode=TwoWay}" IsEnabled="{Binding UsePercentChange}"  Style="{StaticResource TextBoxStyle}"/>
                            <TextBox Margin="94,56,0,0" Text="{Binding AbsoluteChange, Mode=TwoWay}" IsEnabled="{Binding UseAbsoluteChange}"  Style="{StaticResource TextBoxStyle}"/>
                        </Grid>
                    </Border>
                </Grid>
            </Border>
        </Grid>
    </ScrollViewer>
</UserControl>